local ma__jieman = fk.CreateSkill({
  name = "ma__jieman",
  tags = { Skill.Compulsory },
})

Fk:loadTranslationTable{
  ["ma__jieman"] = "桀慢",
  [":ma__jieman"] = "锁定技，手牌数小于你的角色对你使用牌时或响应你使用的牌时，其须弃置一张牌。",
  ["#ma__jieman-discard"] = "桀慢：请弃置一张牌",

  ["$ma__jieman1"] = "",
  ["$ma__jieman2"] = "",
}

local ma__jieman_spec = {
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if not target.dead and not target:isNude() then
        room:askToDiscard(target, {
          min_num = 1,
          max_num = 1,
          include_equip = true,
          skill_name = ma__jieman.name,
          cancelable = false,
          prompt = "#ma__jieman-discard",
        })
    end
  end,
}

ma__jieman:addEffect(fk.CardUseFinished, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    if
      player:hasSkill(ma__jieman.name) and
      data.responseToEvent and
      data.responseToEvent.card
    then
      return target and target ~= player and data.responseToEvent.from == player and
      not target:isNude() and target:getHandcardNum() < player:getHandcardNum()
    end
  end,
  on_cost = ma__jieman_spec.on_cost,
  on_use = ma__jieman_spec.on_use,
})
ma__jieman:addEffect(fk.CardRespondFinished, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(ma__jieman.name) and data.responseToEvent.card then
      return target and target ~= player and data.responseToEvent.from == player and
      not target:isNude() and target:getHandcardNum() < player:getHandcardNum()
    end
  end,
  on_cost = ma__jieman_spec.on_cost,
  on_use = ma__jieman_spec.on_use,
})
ma__jieman:addEffect(fk.CardUsing, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target ~= player and player:hasSkill(ma__jieman.name) and
      table.contains(data.tos, player) and not target.dead and target:getHandcardNum() < player:getHandcardNum()
  end,
  on_cost = ma__jieman_spec.on_cost,
  on_use = ma__jieman_spec.on_use,
})

return ma__jieman